﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GoShopping.BLL;
using GoShopping.Model.Enumerations;
using GoShopping.Model;
using System.Security.Principal;


namespace GoShopping.Web.UserControls
{
    public partial class Banner : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetDDLSearch();
            }
        }

        protected void LBMyinfo_Click(object sender, EventArgs e)
        {
            string UserName = HttpContext.Current.User.Identity.Name;
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                Response.Redirect("MyUserInfo.aspx?UserName=" + UserName);
            }
        }

        protected void likbtnLogin_Click(object sender, EventArgs e)
        {
            Response.Redirect("Login.aspx");
        }

        protected void likbtnRegister_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/register.aspx");
        }
        private void SetDDLSearch()
        {
            all_categories.Items.Clear();
            //ListItem li1 = new ListItem("--请选择--", "-1");
            ListItem li2 = new ListItem("商品名", "Product");
            ListItem li3 = new ListItem("品牌名称", "Brand");
            ListItem li4 = new ListItem("商品类型", "ProductType");
            ListItem li5 = new ListItem("供应商", "Supplyer");
            //all_categories.Items.Add(li1);
            all_categories.Items.Add(li2);
            all_categories.Items.Add(li3);
            all_categories.Items.Add(li4);
            all_categories.Items.Add(li5);
        }
        protected void search2_Click(object sender, ImageClickEventArgs e)
        {

            if (txtSearch.Text.Trim() == "")
            {
                return;
            }
            Response.Redirect("~/ProductListShow.aspx?" + all_categories.SelectedValue + "=" + txtSearch.Text.Trim());
        }
}
}